﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="BuXiaChu.OrderDishes.Web.Admin.Restaurant.Index" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register TagPrefix="Menu" TagName="Header" Src="~/Modules/Menu/Header.ascx" %>
<%@ Register TagPrefix="Menu" TagName="Footer" Src="~/Modules/Menu/Footer.ascx" %>
<%@ Register TagPrefix="Menu" TagName="CityLeft" Src="~/Modules/Menu/CityLeft.ascx" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link media="screen, projection" rel="stylesheet" type="text/css" href="/css/Blueprint/screen.css" />
    <link media="screen, projection" rel="stylesheet" type="text/css" href="/css/main.css" />

    <script type="text/javascript" src="../js/Extend.js"></script>

    <script type="text/javascript" src="../js/Common.js"></script>

    <script type="text/javascript" src="../js/jquery-vsdoc.js"></script>

</head>
<body>
    <div class="container">
        <Menu:Header ID="Header1" runat="server" />
        <form id="form1" runat="server">
        <Menu:CityLeft ID="menu_CityLeft" runat="server" />
        <div class="span-20 last">
            <div class="boxc">
                <a href="Add.aspx"">增加餐馆</a>
                <hr />
                <span>餐厅名称：</span><input type="text" id="txt_Name" />
                <span>所属城市：</span><select runat="server" id="sel_City"></select>
                <span>所属区域：</span><select id="sel_Area"></select>
                <span>餐厅类别：</span><select id="sel_Cat" runat="server"></select>
                <input type="button" value="搜索" id="btn_Search" />
            </div>
            <div class="boxc">
                <div id="div_List">
                    数据加载中...</div>
            </div>
        </div>
        </form>
        <Menu:Footer ID="Footer1" runat="server" />
    </div>
</body>
</html>

<script type="text/javascript">
    fillAreaList();
    function searchRestaurant(index, size, count) {
        var postData = { name: jDoc("txt_Name").value };
        postData.city = jDoc("sel_City").options[jDoc("sel_City").selectedIndex].value;
        postData.area = jDoc("sel_Area").options[jDoc("sel_Area").selectedIndex].value;
        postData.cat = jDoc("sel_Cat").options[jDoc("sel_Cat").selectedIndex].value;
        postData.ajaxCallback = "searchRestaurant({index}, {size}, {count})";
        postData.pageIndex = index == undefined ? 1 : index;
        postData.pageSize = size == undefined ? 15 : size;
        postData.pageCount = count == undefined ? 0 : count;
        $.post("GetList.ashx", postData
        , function(data) {
            jDoc("div_List").innerHTML = data.message;
            jDoc.getElementsBy("div_List", "td", function(e) {
                if (e.getAttribute("data-type") == "city") {
                    for (var i = 0, len = jDoc("sel_City").length; i < len; i++) {
                        if (jDoc("sel_City").options[i].value == e.innerHTML.trim()) {
                            e.innerHTML = jDoc("sel_City").options[i].text;
                            break;
                        }
                    }
                }
            });
        }, "json");
    }
    jDoc.addEventHandler(jDoc("btn_Search"), "click", function() { searchRestaurant(1, 3, 0) });
    jDoc("btn_Search").click();
</script>

